package com.huadao.cart_ccs.data.bo;

import com.huadao.cart_ccs.R;
import com.huadao.cart_ccs.main.CartApplication;

public class DoorBO extends BaseBO {
    public static final byte ModularType_Door =0x5;
    public static final byte door_NO1 = 0x01;//门
    public static final byte close = (byte) 0xAA;//关门
    public static final byte open = (byte) 0xCC;//开门
    public static final byte read = (byte) 0xFF;//读
    public static final byte stop = (byte) 0xDD;//急停

    private byte status;
    public static byte DOOR_HALFOPEN=0x00;
    public static byte DOOR_CLOSE=0x01;
    public static byte DOOR_FULLOPEN=0x02;

    public byte getStatus() {
        return status;
    }

    public void setStatus(byte status) {
        this.status = status;
    }

    @Override
    protected String getOrderStr() {
        String orderStr = null;
        if (order == close) {
            orderStr = CartApplication.getInstance().getString(R.string.close_door);
        } else if (order == open) {
            orderStr = CartApplication.getInstance().getString(R.string.open_door);
        }else if (order == read) {
            orderStr = CartApplication.getInstance().getString(R.string.read);
        }else if(order==stop){
            orderStr=CartApplication.getInstance().getString(R.string.stop);
        }
        return orderStr;
    }

    @Override
    protected String getOrderContentStr() {
        if(order!=read){
            return super.getOrderContentStr();
        }
        String statusStr="";
        if (status == DOOR_HALFOPEN) {
            statusStr=CartApplication.getInstance().getString(R.string.door_status_halfopen);
        }else if(status == DOOR_CLOSE){
            statusStr=CartApplication.getInstance().getString(R.string.door_status_close);
        }else if(status == DOOR_FULLOPEN){
            statusStr=CartApplication.getInstance().getString(R.string.door_status_fullopen);
        }
        return statusStr;
    }

    @Override
    protected String getModularTypeStr() {
        return CartApplication.getInstance().getString(R.string.door);
    }

    public String getStatusStr(){
        return getOrderContentStr();
    }
}
